home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-05-14 | 2.1 KB | 86 lines |
- import ComponentApp;
-
- public class ExternalPictureComp extends ComponentApp
- {
- DDrawPicture cdp;
- String theSource;
- String codebase;
- DAssetManager assetMan;
-
-
- public void onCopy()
- {
-
- }
-
- public String onInstall(DAssetManager cam, String codebase)
- {
- assetMan=cam;
- this.codebase=codebase;
- return "Picture Loader";
- }
-
- public void onInspect(CStringArray Names,CStringArray Types)
- {
- Names.Set("Image URL");
- Types.Set(typeString);
- }
-
- public String PropertyListener(String Event,String Value,int Get, int propIndex, IDInspector insp)
- {
- if (Get == 1)
- {
- if (Event.compareTo("Image URL") == 0)
- {
- return theSource;
- }
- }
- else
- {
- if (Event.compareTo("Image URL") == 0)
- {
- theSource=Value;
- if(!(theSource.indexOf(":")>0))
- {
- theSource="http://"+theSource;
- }
- }
- cdp.setHTMLBefore("<img src=\""+theSource+"\"><!--");
- cdp.setHTMLAfter("-->");
- cdp.setPictureText(theSource);
- cdp.Invalidate(true);
- }
- return "";
- }
-
- protected void finalize()
- {
- }
-
-
- public void onDrop(IDLayout layout, IDRect r, int fDrop)
- {
- //
- // we only process drop for now
- //
- if (fDrop != ActivateState.Drop)
- return;
-
- theSource="";
- cdp = new DDrawPicture();
- cdp.SetPositionRect(r.getLeft(), r.getTop(), r.getRight(), r.getBottom());
- cdp.setStretch(PictureStretchMode.DRAW_STRETCHED);
- cdp.setUsePictureText(true);
- cdp.setPictureText("Picture Loader");
- cdp.setImageFile(codebase + "ExternalPictureComp.gif");
- layout.AddObject(cdp);
- }
-
- public void onUnInstall(DAssetManager cam)
- {
- }
-
- public void onPublish(DAssetManager asm, int context)
- {
- }
- }